package ink.lovejinhu.leetcode;

import java.util.Arrays;

/**
 * @author jinhu
 * created 2021-07-30 11:24
 */
public class Solution_0645 {
    public int[] findErrorNums(int[] nums) {
        Arrays.sort(nums);
        int[] res = new int[2];
        for (int i = 0; i < nums.length; i++) {
            if (!(nums[i] == i + 1)) {
                nums[i] = i + 1;
                res[0] = nums[i];
                res[1] = i + 1;
                break;
            }
        }
        return res;
    }
}
